/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exercicio.lista1;

import java.util.Random;

/**
 *
 * @author afonso
 */
public class Questao5 {
    
    public static void main(String[] args) {
        int nExp =100000;
        Random r = new Random(System.currentTimeMillis());
        int evento = 0;
        
        for (int i = 0; i < nExp; i++) {
            double y = (r.nextDouble() * (Math.PI - 0)) + 0;
            if(y >= 0.5){
                evento++;
            }
        }
        
        double p = (double) evento / nExp;
        System.out.println("Probabilidade: " + p);
    }
    
}
